﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="YearPlanSP_ExtendForm.aspx.vb"
    Inherits="PubProject.YearPlanSP_ExtendForm" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title></title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
    <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">

    <script language="javascript" src="/_common/scripts/global.js"></script>

    <script language="javascript" src="/_controls/settings.aspx"></script>

    <script language="javascript" src="/_controls/util/util.js"></script>

    <script language="javascript" src="/_controls/number/number.js"></script>

    <script language="javascript" src="/_controls/datetime/date.js"></script>

    <script language="javascript" src="/MyWorkflow/Workflow.js"></script>

    <script language="javascript" src="/MyWorkflow/Blank.js"></script>

    <script language="javascript" src="/PubProject/js/Public.js"></script>
    <script language="javascript" src="/Qmys/JS/Public.js"></script>

    <style>
        body
        {
            font-size: 9pt;
        }
        table
        {
            font-size: 9pt;
        }
        P
        {
            font-size: 9pt;
        }
    </style>
    <link href="/MyWorkflow/css/form.css" type="text/css" rel="stylesheet">

    <script language="javascript">
        /*------------------------------------------------------------------*/
        //表单接口函数，需扩展
        //1、Fill	--	表单填充
        //2、GetXML --	表单取数
        //3、Valid	--	表单校验
        /*------------------------------------------------------------------*/
        //屏避右键
        function document.oncontextmenu() {
            var s = event.srcElement.tagName;
            if (s && s != "INPUT" && s != "TEXTAREA" || event.srcElement.disabled || document.selection.createRange().text.length == 0) {
                event.returnValue = false;
            }
        }
        //功能：表单填充
        //editableDomainList	当前步骤可编辑域
        //invisibleDomainList   当前步骤不可见域
        //domainXML				域XML
        function Fill(editableDomainList, invisibleDomainList, domainXML) 
        {
            var strBusinessType;
            var xmlDom = new ActiveXObject("Microsoft.XMLDOM");
            if (domainXML && domainXML.length > 0) 
            {
                xmlDom.async = false;
                xmlDom.loadXML(domainXML);
                if (xmlDom.parseError.errorCode != 0) 
                {
                    xmlDom = null;
                }
            }
            else {
                xmlDom = null;
            }
            
            if (xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='公司GUID']")) {
                Form1.txtBUGUID.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='公司GUID']").text
                Form1.txtBUName.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='公司名称']").text
                Form1.txtYearPlanGUID.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='版本GUID']").text
                Form1.txtPlanName.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='版本名称']").text
                Form1.txtPlanYear.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='年度']").text
                Form1.txtReportedBy.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='上报人名称']").text
                Form1.txtReportDate.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='上报日期']").text
                Form1.txtSaleCount.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='收入合计']").text
                Form1.txtExpendCount.value = xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='支出合计']").text

               //判断是否历史流程或已作废，如果是历史流程或已作废则隐藏列表
                var isHistory = xmlDom.documentElement.getAttribute("IsHistory");
                var strProcessStatus = xmlDom.documentElement.getAttribute("ProcessStatus"); //工作流状态

                if (isHistory == 1 || strProcessStatus == "-2") 
                {//历史流程或已作废则隐藏列表

                }
                else 
                {
                    var sPath = "/Qmys/YearYs/YearPlanApprove_Grid.aspx?mode=3&xml=/Qmys/YearYs/YearPlanApprove_Grid_View.xml&BUGUID=" + Form1.txtBUGUID.value + "&YearPlanGUID=" + Form1.txtYearPlanGUID.value + GetFunctionCodeParam("公司年度预算审批");
                    document.all["appIframe"].src = sPath;
                }
            } 		
        }

        //功能：表单取数
        //参数：取值前的domainxml
        //返回值 取值后的domainxml
        function GetXML(domainXML) {
            var xmlDom = new ActiveXObject("Microsoft.XMLDOM");

            xmlDom.async = false;
            xmlDom.loadXML(domainXML);

            if (xmlDom.parseError.errorCode != 0) {
                return "";
            }
            xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='公司GUID']").text = Form1.txtBUGUID.value;
            xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='公司名称']").text = Form1.txtBUName.value;
            xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='版本GUID']").text = Form1.txtYearPlanGUID.value;
            xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='版本名称']").text = Form1.txtPlanName.value;
            xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='年度']").text = Form1.txtPlanYear.value;
            xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='上报人名称']").text = Form1.txtReportedBy.value;
            xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='上报日期']").text = Form1.txtReportDate.value;
            xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='收入合计']").text = Form1.txtSaleCount.value;
            xmlDom.selectSingleNode("/BusinessType/Item/Domain[@name='支出合计']").text = Form1.txtExpendCount.value;
            return xmlDom.xml;
        }

        //功能：表单校验
        //参数：可编辑域列表
        function Valid(editableDomainList) {
            return true;
        }

        //功能：发起审批时校验	
        function InitValidate() {

            //校验公司下的所有部门及项目是否全部审核(项目成本、销售收入、部门费用)
            var sReturn = GetDataFromXMLHTTP("/Qmys/YearYs/YearYs_XMLHTTP.aspx", "VerifyDetailYearApproveState", "", Form1.txtYearPlanGUID.value + "|" + Form1.txtBUGUID.value);

            //所有的部门和项目都没有上报，不允许上报公司年度预算
            if (sReturn == "1") {
                alert("公司下无年度预算数据，不允许发起审批！");
                return false;
            }

            //存在已上报但没有审核的部门或项目，不允许上报公司年度预算
            if (sReturn == "2") {
                alert("存在审核中的年度预算，不允许发起审批！");
                return false;
            }
            //上级公司预算已上报
            if (sReturn == "3") {
                alert("上级公司年度预算已审核，不允许发起审批！");
                return false;
            }

            if (sReturn == "FAIL") {
                alert("操作失败，请关闭重试！"); return false;
            }
           
            return true;
        }
			
    </script>

</head>
<body ms_positioning="GridLayout" style="overflow: auto">
    <form id="Form1" method="post" runat="server">
    <asp:TextBox ID="txtYearPlan2ObjectGUID" runat="server" Style="display: none"></asp:TextBox>
    <asp:TextBox ID="txtBUGUID" runat="server" Style="display: none"></asp:TextBox>
    <%--<asp:TextBox ID="txtBUName" runat="server" Style="display: none"></asp:TextBox>--%>
    <asp:TextBox ID="txtYearPlanGUID" runat="server" Style="display: none"></asp:TextBox>
    <table width="100%" height="100%">
        <tbody>
            <tr heigth="20">
                <td>
                    <!-- 表单 -->
                    <p align="center" id="pTitle">
                        <font style="font-size: 16px"><strong>公司年度预算审批单</strong></font></p>
                </td>
            </tr>
            <tr height="10">
                <td>
                </td>
            </tr>
            <tr height="100%">
                <td>
                    <table style="font-size: 9pt" height="100%" cellspacing="0" cellpadding="0" width="100%">
                        <tr height="1">
                            <td>
                                <!--Begin of 下拉列表控件-->
                                <table style="table-layout: fixed; vertical-align: text-bottom; width: 100%; height: 30px"
                                    cellspacing="5" cellpadding="0" border="0" id="appQuery" class="appQuery" onquery="_DoQuery()">
                                    <colgroup>
                                        <col width="60">
                                        <col width="160">
                                        <col>
                                        <col width="80">
                                        <col width="100">
                                        <col>
                                        <col width="80">
                                        <col width="100">
                                        <col>
                                        <col width="60">
                                        <col width="100">
                                        <col>
                                    </colgroup>
                                    <tr>
                                        <td align="left">
                                            <b style="color: #666666">组织机构</b>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtBUName" runat="server" Enabled="False" Width="150px" ReadOnly="true"></asp:TextBox>
                                        </td>
                                        <td>
                                        </td>
                                        <td align="left">
                                            <!--左边下拉列表控件标题-->
                                            <b style="color: #666666">年度</b>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtPlanYear" runat="server" Width="100px" Style="text-align: center"
                                                ReadOnly="true"></asp:TextBox>
                                        </td>
                                        <td>
                                        </td>
                                        <td align="left">
                                            <b style="color: #666666">版本</b>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtPlanName" runat="server" Width="100px" ReadOnly="true"></asp:TextBox>
                                        </td>
                                        <td>
                                        </td>
                                        <td align="left">
                                            <b style="color: #666666">上报人</b>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtReportedBy" runat="server" Width="100px" ReadOnly="true"></asp:TextBox>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left">
                                            <b style="color: #666666">上报日期</b>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtReportDate" runat="server" Width="150px" Style="text-align: center"
                                                ReadOnly="true"></asp:TextBox>
                                        </td>
                                        <td>
                                        </td>
                                        <td align="left">
                                            <b style="color: #666666">上报支出合计</b>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtExpendCount" runat="server" Width="100px" Style="text-align: right"
                                                ReadOnly="true"></asp:TextBox>
                                        </td>
                                        <td>
                                        </td>
                                        <td align="left">
                                            <b style="color: #666666">上报收入合计</b>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtSaleCount" runat="server" Width="100px" Style="text-align: right"
                                                ReadOnly="true"></asp:TextBox>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                        <td>
                                        </td>
                                    </tr>
                                </table>
                                <!--End of下拉列表控件-->
                            </td>
                            <tr>
                                <td>
                                    <iframe id="appIframe" src="" width="100%" height="100%" frameborder="0" scrolling="no">
                                    </iframe>
                                </td>
                            </tr>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>
    </form>
</body>
</html>
